package khs.java_json.main.java;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws JsonGenerationException, JsonMappingException, IOException
    {
        ObjectMapper mapper = new ObjectMapper();
        
        Map<String, String> dummy = new HashMap<String, String>();
        dummy.put("param1", "value1");
        dummy.put("param2", "value2");
        
        String stringify_data = mapper.writeValueAsString(dummy);
        Map<String, String> parse_data = mapper.readValue(stringify_data, new TypeReference<HashMap<String, String>>() {});
        
        System.out.println(">>>>>>>>>>>>>> stringify");
        System.out.println(stringify_data);
        
        System.out.println(">>>>>>>>>>>>>> parse");
        System.out.println(parse_data);
    }
}
